import Vue from 'vue'
import Vuex from 'vuex'
// import axios from 'axios'
import movieModule from './modules/movieModule.js'
import detailModule from './modules/detailModule.js'

Vue.use(Vuex)

export default new Vuex.Store({
  // state: {
  //   movieList: [],
  //   detailMovie: {}
  // },
  // mutations: {
  //   updateMovieList (state, payload) {
  //     state.movieList = payload
  //   },
  //   updateDetailMovie (state, payload) {
  //     state.detailMovie = { ...payload }
  //   }
  // },
  // actions: {
  //   async  getMovieList ({ commit }) {
  //     const res = await axios.get('http://test.zjie.wang/api/hot')
  //     console.log(res)
  //     commit('updateMovieList', res.data.hot)
  //   },

  //   async getDetailMovie ({ commit, id }) {
  //     const res = await axios.get('http://test.zjie.wang/api/hot/' + id)
  //     commit('updateDetailMovie', res.data)
  //     console.log(res)
  //   }
  // },
  modules: {
    movie: movieModule,
    detail: detailModule
  }
})
